import React, {PropsWithChildren, useEffect, useState} from 'react'
import {Button, Card, Space, Table} from "antd";
import {getAllMarketShoppingGuideByMarketId, MarketShoppingGuideResponse} from "../../apis/MarketShoopingGuideApi";

export interface MarketShoppingGuidesTabPageProps extends PropsWithChildren {
    id: number
}

const MarketShoppingGuidesTabPage: React.FC<MarketShoppingGuidesTabPageProps> = (props) => {

    const [marketShoppingGuides, setMarketShoppingGuides] = useState<MarketShoppingGuideResponse[]>([])

    useEffect(() => {
        getAllMarketShoppingGuideByMarketId(props.id).then(response => {
            setMarketShoppingGuides(response.data)
        })
    }, [props.id])

    const [openSalaryRuleDrawer, setOpenSalaryRuleDrawer] = useState(false)
    return <>
        <Space direction={"vertical"}>
            <Card title={"导购管理"}>
                <Table dataSource={marketShoppingGuides} rowKey={"id"} columns={[{
                    key: "name",
                }, {
                    key: "phoneNumber",
                }]}></Table>
            </Card>
            <Card title={"薪水"} extra={<Space>
                <Button type={"link"} onClick={() => setOpenSalaryRuleDrawer(true)}>薪水方案</Button>
            </Space>}>

            </Card>
        </Space>
    </>
}

export default MarketShoppingGuidesTabPage


